home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
I-Info Magazine
/
(c)i19.d64
/
form maker2
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
8KB
|
254 lines
10 REM *** LFS FORM MAKER2 ***
20 REM
30 REM 5/31/87 VERSION
40 REM
50 REM COPYRIGHT, 1987
60 REM LOUIS F. SANDER
70 REM 153 MAYER DRIVE
80 REM PITTSBURGH, PA 15237
90 REM
120 REM *** MAIN LOOP
130 GOSUB190:REM INITIALIZE
140 GOSUB270:REM MAIN MENU
150 ON A GOSUB390,640,930,1250,1470:REM MENU SELECTIONS
160 RUN
170 :
180 REM *** INITIALIZE
190 DIM CW%(255),LL$(255),RL$(255)
200 PW=80:PI=11:K1=631:K2=198:IFPEEK(65534)<>72THENK1=842:K2=208:REM 64OR128?
210 EM$=" [158] ERROR! MUST BE AT LEAST 1 ":Q$=CHR$(34)
220 R$=CHR$(13):TL$="[147][158][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164]"
230 POKE53280,6:POKE53281,6
240 RETURN
250 :
260 REM *** MAIN MENU
270 PRINTTL$;" LFS FORM MAKER - LOUIS F. SANDER - 5/87[146][160]"
280 PRINT"[153]THIS LETS YOU DESIGN FORMS. SELECT:"
290 PRINT" 1 - CREATE A NEW FORM
300 [153]" 2 - EDIT AN EXISTING FORM
310 PRINT" 3 - PRINT AN EXISTING FORM
320 [153]" 4 - INSTRUCTIONS
330 PRINT" 5 - QUIT
340 [161]A$:[139]A$[178]""[167]340
350 A[178][197](A$):[139]A[179]1[176]A[177]5[167]340
360 [142]
370 :
380 [143] *** CREATE
390 [153]TL$;" CREATE A NEW FORM WAITCLOSE"
400 [153]"PRINTTHIS LETS YOU CREATE A NEW FORM AND
410 PRINT"SAVE IT ONTO YOUR DISK.
420 [153]"PRESS <RETURN> TO RETURN TO THE MENU,
430 PRINT"OR PRESS ANY OTHER KEY TO CONTINUE...
440 [161]A$:[139]A$[178]""[167]440
450 [139]A$[178]R$[167]610
460 [141]1660
470 [133]" PRINT A COPY NOW (Y OR N) YCMDCMDCMD";A$
480 [139][200](A$,1)[178]"Y"[167][141]960
490 [153]"PRINTTO SAVE THE FORM AS A FILE ON THE DISK,
500 PRINT"YOU MUST GIVE IT A UNIQUE FILE NAME OF"
510 PRINT"14 CHARACTERS OR FEWER.
520 [153]"SAVED FORMS CAN EASILY BE PRINTED OR
530 PRINT"EDITED USING OPTIONS FROM THE MAIN MENU.
540 [153]"ENTER THE FORM NAME NOW, OR PRESS
550 PRINT"<RETURN> TO RETURN TO THE MENU.
560 [153][163]15);"LISTTAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB(ONON"
570 F$[178]"":[133]" FORM NAME";F$:F$[178]"F/"[170]F$:[139]F$[178]"F/"[167][138]
580 [159]15,8,15:[159]2,8,2,F$[170]",S,W"
590 [132]15,A,A$:[139]A[177]19[167][160]2:[160]15:[153]"SYS ";A$;" ":[137]560
600 [141]2500
610 [142]
620 :
630 [143] *** EDIT
640 [153]TL$;" EDIT AN EXISTING FORM WAITCLOSE"
650 [153]"PRINTTHIS LETS YOU LOAD AND MODIFY AN
660 PRINT"EXISTING FORM. YOU CAN THEN SAVE IT
670 [153]"UNDER THE SAME NAME OR A NEW ONE.
680 GOSUB1510
690 OF$=F$
700 GOSUB1660
710 INPUT" PRINT A COPY NOW (Y OR N) Y[157][157][157]";A$
720 IFLEFT$(A$,1)="Y"THENGOSUB960
730 PRINT"[153]TO SAVE THE FORM AS A FILE ON THE DISK,
740 [153]"YOU MUST GIVE IT A UNIQUE FILE NAME OF"
750 [153]"14 CHARACTERS OR FEWER.
760 PRINT"SAVED FORMS CAN EASILY BE PRINTED OR
770 [153]"EDITED USING OPTIONS FROM THE MAIN MENU.
780 PRINT"[153]ENTER THE NEW NAME UNDER WHICH YOU WANT
790 [153]"TO SAVE THE EDITED FORM, OR PRESS
800 PRINT"<RETURN> TO RETURN TO THE MAIN MENU."
810 PRINT"'@[153]' WILL SAVE IT UNDER ITS ORIGINAL
820 [153]"NAME, WHICH IS ";[202](OF$,3);"PRINT"
830 [153][163]15);"LISTTAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB(ONON"
840 F$[178]"":[133]" FORM NAME";F$:F$[178]"F/"[170]F$
850 [139]F$[178]"F/"[167]900
860 [159]15,8,15:[139]F$[178]"F/@"[167]F$[178]OF$:[152]15,"S0:"[170]F$
870 [159]2,8,2,F$[170]",S,W"
880 [132]15,A,A$:[139]A[177]19[167][160]2:[160]15:[153]"SYS ";A$;" ":[137]830
890 [141]2500
900 [142]
910 :
920 [143] *** PRINT
930 [153]TL$;" PRINT AN EXISTING FORM WAITCLOSE"
940 [153]"PRINTTHIS LETS YOU LOAD AND PRINT A FORM THATHAS BEEN SAVED ON THE DISK.
950 GOSUB1510
960 PRINT"[153]THE FORM IS" LEFT$(STR$((LW+W)/10),5);Q$;" WIDE BY";
970 PRINTLEFT$(STR$(TL%/9),5);Q$;" LONG,"
980 PRINT"OR";LW+W;"SPACES WIDE BY";TL%;"LINES LONG."
990 PRINT"[153]";:OPEN15,4,15:CLOSE15:IFSTTHENPRINT"PUT THE PRINTER ONLINE,
1000 [153]"ALIGN THE PAPER IN THE PRINTER,
1010 PRINT"THEN PRESS THE 'P[153]' KEY... "
1020 GETA$:IFA$<>"P"THEN1020
1030 OPEN15,4,15:CLOSE15:IFSTTHENPRINT"[158] PRINTER IS OFFLINE! ":GOTO990
1040 TX$=CHR$(15) :REM TEXT MODE
1050 GR$=CHR$(8) :REM GRAPHICS MODE (FOR LINE SPACING)
1060 OPEN4,4:GOSUB1200:PRINT#4,LW$;CL$
1070 FORH=1TONR%:GOSUB1220;:FORJ=1TONC%:PRINT#4,CHR$(207);:FORK=1TOCW%(J)-1
1080 IFCW%(J)>1THENPRINT#4,CHR$(163);
1090 NEXT:NEXT:PRINT#4,CHR$(165);GR$:IFLR%<2THEN1130
1100 FORI=1TOLR%-1:GOSUB1220;:FORJ=1TONC%:PRINT#4,CHR$(165);:FORK=1TOCW%(J)-1
1110 IFCW%(J)>1THENPRINT#4," ";
1120 NEXT:NEXT:PRINT#4,CHR$(165);GR$:NEXT
1130 NEXT:GOSUB1220;:FORJ=1TONC%:FORK=1TOCW%(J):PRINT#4,CHR$(163);:NEXT:NEXT
1140 PRINT#4:CLOSE4
1150 INPUT"PRINT ANOTHER COPY (Y OR N) N[157][157][157]";A$
1160 IFLEFT$(A$,1)="Y"THENLC=0:PRINT:GOTO990
1170 RETURN
1180 :
1190 REM PUTS ROW LABELS IN PLACE
1200 FORJ=1TOTL%:LL$(J)=LW$:NEXT
1210 LN=1:FORK=1+INT((LR%-1)/2)TOTL%-1STEPLR%:LL$(K)=RL$(LN):LN=LN+1:NEXT
1220 PRINT#4,TX$;LL$(LC);:LC=LC+1:RETURN:REM ROW LABELS
1230 :
1240 REM *** INSTRUCTIONS
1250 PRINT"[147]THIS LETS YOU MAKE FORMS ON THE PRINTER:[160][160]"
1260 PRINT" COLUMN 1 COLUMN 2"
1270 PRINT" [207][183][183][183][183][183][183][183][183][183][183][207][183][183][183][183][183][183][183][183][183][183][183][183][183][165]"
1280 PRINT" ROW 1 [165] [165] [165]"
1290 PRINT" [207][183][183][183][183][183][183][183][183][183][183][207][183][183][183][183][183][183][183][183][183][183][183][183][183][165]"
1300 PRINT" ROW 2 [204][175][175][175][175][175][175][175][175][175][175][204][175][175][175][175][175][175][175][175][175][175][175][175][175][165]"
1310 PRINT" [165] [165] [165]"
1320 PRINT" ROW 3 [204][175][175][175][175][175][175][175][175][175][175][204][175][175][175][175][175][175][175][175][175][175][175][175][175][165]"
1330 PRINT:PRINT"THE FORM CAN BE AS WIDE AS YOUR PRINTER,"
1340 PRINT"[145]LESS ONE SPACE. THERE ARE 10 PRINTED"
1350 PRINT"SPACES PER INCH OF FORM WIDTH, AND NINE"
1360 PRINT"PRINTER LINES PER INCH OF FORM HEIGHT.
1370 [153]:[153]"YOU CHOOSE AN INDIVIDUAL WIDTH FOR EACH"
1380 [153]"COLUMN, AND ONE HEIGHT FOR ALL THE ROWS."
1390 [153]"YOU CAN LABEL THE COLUMNS AND ROWS.
1400 PRINT:PRINT"FORMS MAY BE SAVED TO DISK. SAVED FORMS
1410 [153]"CAN BE REPRINTED AND/OR EDITED.
1420 PRINT"[153] PRESS ANY KEY TO CONTINUE..."
1430 GETA$:IFA$=""THEN1430
1440 RETURN
1450 :
1460 REM *** QUIT
1470 POKE53280,14:PRINT"[154]"
1480 END
1490 :
1500 REM ** FORM LOADER
1510 PRINT"[153]ENTER THE NAME OF AN EXISTING FORM, OR
1520 [153]"PRESS <RETURN> TO RETURN TO THE MENU.
1530 PRINTTAB(23);"[155][163][163][163][163][163][163][163][163][163][163][163][163][163][163][145][145]"
1540 F$="":INPUT" EXISTING FORM NAME";F$:F$="F/"+F$:IFF$="F/"THENRUN
1550 OPEN15,8,15:OPEN2,8,2,F$+",S,R"
1560 INPUT#15,A,A$:IFA<20THEN1580
1570 PRINT"[158] ";A$;" ":CLOSE2:CLOSE15:PRINT"[145][145]":GOTO1530
1580 INPUT#2,LR%,LW,NC%,NR%,PI,PW,TL%:INPUT#2,CL$
1590 FORJ=1TONC%:INPUT#2,CW%(J):NEXT
1600 FORJ=1TONR%:INPUT#2,RL$(J):NEXT
1610 CLOSE2:CLOSE15
1620 LW$="":FORJ=1TOLW:LW$=LW$+" ":NEXT
1630 RETURN
1640 :
1650 REM ** FORM EDITOR
1660 PRINT" YOUR PRINTER WIDTH IN SPACES ";PW;:A=PW:GOSUB2410
1670 INPUTPW:PW=PW-1:IFPW<1THENPW=80:GOTO1660
1680 PRINT" YOUR PAPER LENGTH IN INCHES ";PI;:A=PI:GOSUB2410
1690 INPUTPI:PL=INT(9*PI):IFPI<1THENPI=11:GOTO1680
1700 PRINT"[153]THE VERTICAL COLUMNS CAN OCCUPY AS MANY
1710 [153]"AS";PW;"PRINT SPACES ACROSS THE PAGE.
1720 PRINT"THERE ARE 10 PRINT SPACES PER INCH.
1730 [153]" HOW MANY COLUMNS ON THE FORM ";NC%;:A[178]NC%:[141]2410
1740 [133]NC%:[139]NC%[179]1[167][153]EM$:[137]1730
1750 [153]:W[178]0:[129]J[178]1[164]NC%
1760 [153]" HOW MANY SPACES IN COLUMN";J;CW%(J);:A[178]CW%(J):[141]2410
1770 [133]A:[139]A[179]1[167][153]EM$:[137]1760
1780 CW%(J)[178]A:W[178]W[170]CW%(J):[130]
1790 [153]"PRINTTHESE COLUMNS TAKE UP";W;"OF THE";PW
1800 [153]"PRINTAVAILABLE SPACES ON YOUR PRINTER. THERE"
1810 [153]"ARE";PW[171]W;"SPACES AVAILABLE FOR LABELING
1820 PRINT"THE HORIZONTAL ROWS.
1830 [139]W[177]PW[167][153]"SYS TOO WIDE! - TRY AGAIN PRINT":[137]1730
1840 [133]" IS THIS O.K. (Y OR N) YCMDCMDCMD";A$
1850 [139][200](A$,1)[179][177]"Y"[167][153]:[137]1730
1860 [153]"PRINTNOW WE WILL SET UP THE HORIZONTAL ROWS,"
1870 [153]"WHICH CAN FILL UP TO";PL[171]1;"PRINTER LINES."
1880 [153]"THERE ARE 9 PRINTER LINES PER INCH.
1890 PRINT" HOW MANY ROWS ON THE FORM ";NR%;:A=NR%:GOSUB2410
1900 INPUTNR%:IFNR%<1THENPRINTEM$:GOTO1890
1910 PRINT:NW=LEN(STR$(NR%))-1:NW$=LEFT$(" ",NW)
1920 PRINT"HOW MANY PRINTER LINES PER ROW ";LR%;:A=LR%:GOSUB2410
1930 INPUTLR%:IFLR%<1THENPRINTEM$:GOTO1920
1940 TL%=NR%*LR%+1
1950 PRINT"[153]THESE ROWS TAKE UP";TL%;"PRINTER LINES,"
1960 PRINT"INCLUDING A LINE FOR COLUMN LABELS."
1970 PRINT"YOUR PAPER HAS";PL;"LINES.";
1980 IFTL%>PLTHENPRINT:PRINT"[158] ERROR! - TOO LONG FOR THE PAPER [153]":GOTO1890
1990 PRINT"[157], LEAVING";PL-TL%
2000 PRINT"LINES UNPRINTED."
2010 INPUT" IS THIS O.K. (Y OR N) Y[157][157][157]";A$
2020 IFLEFT$(A$,1)<>"Y"THENPRINT:GOTO1890
2030 PRINT"[153]NOW WE WILL DO THE OPTIONAL LABELS.
2040 [153]"YOUR FORM HAS";NC%;"VERTICAL COLUMNS,
2050 PRINT"WHICH YOU CAN LABEL IF YOU WISH.
2060 [133]" LABEL THE COLUMNS (Y OR N) YCMDCMDCMD";A$
2070 [139][200](A$,1)[179][177]"Y"[167]CL$[178]" ":[137]2200
2080 [141]2430:LS[178]0:[129]J[178]1[164]NC%
2090 [153]"LABEL FOR COLUMN";J;"-";CW%(J);"SPACES";
2100 [139]CW%(J)[179]2[167][153]"CMD ";
2110 [153]:[153]" ";Q$;[199](20);Q$;
2120 [139]CL$[178]""[167][129]K[178]1[164]CW%(J):[153]" ";:[130]:[137]2150
2130 [139][195](CL$)[179]W[167]CL$[178]CL$[170]" ":[137]2130
2140 [153][202](CL$,LS[170]1,CW%(J));:LS[178]LS[170]CW%(J)
2150 A[178][185](0):[153]Q$:[139]A[177]38[167][153]"ON";
2160 [153]"ON";:[151]K1,29:[151]K2,1:[133]A$
2170 [139][195](A$)[179][177]CW%(J)[167][153]"SYS WRONG WIDTH! - TRY AGAIN ":[137] 2090
2180 L$[178]L$[170]A$:[130]:CL$[178]L$
2190 :
2200 [133]" LABEL THE ROWS (Y OR N) YCMDCMDCMD";A$
2210 [139][200](A$,1)[179][177]"Y"[167]2390:[143] THIS DEST OK??
2220 [153]"PRINTTHE FORM IS";W;"SPACES WIDE, LEAVING"
2230 [153]"CMD";PW[171]W;"SPACES FOR LABELING ITS";NR%:[153]"HORIZONTAL ROWS.
2240 PRINT" HOW MANY TO ALLOW FOR LABELS ";LW;:A=LW:GOSUB2410
2250 INPUTLW:IFLW<1THENPRINTEM$:GOTO2240:REM MAYBE NOT NEEDED
2260 IFLW>PW-WTHENPRINT" [158] ERROR! -";PW-W;"[157] MAXIMUM ":GOTO2240
2270 LW$="":FORJ=1TOLW:LW$=LW$+" ":NEXT
2280 GOSUB2430
2290 FORJ=1TONR%
2300 RL$=RL$(J)+LW$:PRINT"LABEL FOR ROW";J;"-";LW;"SPACES";
2310 IFLW<2THENPRINT"[157] ";
2320 PRINT:PRINT" ";Q$;MID$(RL$,1,LW);
2330 A=POS(0):PRINTQ$:IFA>38THENPRINT"[145]";
2340 PRINT"[145]";:POKEK1,29:POKEK2,1:INPUTRL$
2350 IFLEN(RL$)<>LWTHENPRINT"[158] WRONG LENGTH!! - TRY AGAIN ":GOTO2300
2360 RL$(J)=RL$
2370 NEXT
2380 PRINT"[153]YOUR FORM IS FINISHED!"
2390 RETURN
2400 :
2410 PRINTLEFT$("[157][157][157][157][157][157][157][157]",2+LEN(STR$(A)));:RETURN:REM ALIGN INPUT
2420 :
2430 PRINT"[153]ENTER THE LABELS RIGHT NOW. YOU MUST"
2440 PRINT"KEEP THEM BETWEEN THE QUOTATION MARKS,"
2450 PRINT"BUT YOU CAN CENTER THEM OR POSITION"
2460 PRINT"THEM AS YOU LIKE."
2470 RETURN
2480 :
2490 REM ** FORM SAVER
2500 PRINT#2,LR%;R$;LW;R$;NC%;R$;NR%;R$;PI;R$;PW+1;R$;TL%
2510 PRINT#2,Q$+CL$+Q$
2520 FORJ=1TONC%:PRINT#2,CW%(J):NEXT
2530 FORJ=1TONR%:PRINT#2,Q$+RL$(J)+Q$:NEXT
2540 CLOSE2:CLOSE15
2550 RETURN